import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
            int count = 0;
           String s1 = in.nextLine();
           String s2 = in.nextLine();

        for(int i = 0;i<s1.length()+1;i++){
               char[] ch = new char[s1.length()+s2.length()];
            for(int j = 0;j<i;j++){
                ch[j] = s1.charAt(j);
            }
            for(int j = 0 ;j<s2.length();j++){
                ch[i+j] = s2.charAt(j);
            }
            for(int j = i;j<s1.length();j++){
                ch[j+s2.length()] = s1.charAt(j);
            }
            if(huiwen(ch)==1)count++;
           }
        System.out.print(count);
        }

    public static int huiwen(char[]c){
        int start=0;
        int end = c.length-1;

        while(start<end){
            if(start<end&&c[start]==c[end]){
                start++;
                end--;
            }
            else return 0;
        }
        return 1;
    } 
}